package cn.starrysky108.simpleerp.pub.request;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @author Carl Lee
 */
@ApiModel("注册参数对象")
@Data
public class UserRegisterRequest {
    @ApiModelProperty(value = "用户名")
    @NotNull(message = "用户名不能为空")
    private String username;

    @ApiModelProperty(value = "密码")
    @NotNull(message = "密码不能为空")
    @Length(min = 8,max = 30,message = "密码长度最低为8位")
    @Pattern(regexp = "^[0-9a-zA-Z_]{8,30}$" ,message = "密码必须由数字与字母组成")
    private String password;

    @ApiModelProperty(value = "真实姓名")
    @NotNull(message = "真实姓名不能为空")
    @Length(max = 20,message ="姓名过长，长度不能超过20")
    private String actualName;

    @ApiModelProperty(value = "电话号码")
    @Pattern(regexp = "^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$",message = "请输入正确的电话号码")
    private String phone;

    @ApiModelProperty(value = "邮箱地址")
    @Email(message = "邮箱地址不正确")
    private String email;

    @ApiModelProperty(value = "住址")
    @Length(min = 10,max = 255,message = "请输入详细地址")
    private String address;

    @ApiModelProperty(value = "户主")
    private Long household;

    @ApiModelProperty(value = "头像")
    private String avatar;
}
